<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/lib/bootstrap/css/bootstrap.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/stylesheets/theme.css" />
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/font-awesome/css/font-awesome.css" />
	<script src="${pageContext.request.contextPath}/static/lib/jquery-1.7.2.min.js" type="text/javascript"></script>
</head>
<body>


<div id="menuDiv" class="sidebar-nav">

</div>

<script src="${pageContext.request.contextPath}/static/lib/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
	var parent="";
	var child="";

	var menuArray=[
		{
			id:"book-menu",
			parent:"商品管理",
			icon:"icon-dashboard",
			childList:[
				{name:"查看商品信息",url:"${pageContext.request.contextPath}/goods/toGoods.do"},
			]
		},
		{
			id:"ad-menu",
			parent:"促销管理",
			icon:"icon-dashboard",
			childList:[
				{name:"首页轮播",url:"${pageContext.request.contextPath}/shuffling/toAd.do"},

			]
		},
		{
			id:"type-menu",
			parent:"分类管理",
			icon:"icon-briefcase",
			childList:[
				{name:"分类列表管理",url:"${pageContext.request.contextPath}/type/toType.do"}
			]
		},
		{
			id:"order-menu",
			parent:"订单管理",
			icon:"icon-legal",
			childList:[
				{name:"订单列表",url:"${pageContext.request.contextPath}/goods/indent.do"},

			]
		},
		{
			id:"account-menu",
			parent:"用户管理",
			icon:"icon-legal",
			childList:[
				{name:"查看用户信息",url:"${pageContext.request.contextPath}/user/usersele.do"},
			]
		},


	];


	function menuClick(currentParent,currentChild){
		parent=currentParent;
		child=currentChild;
		loadMenu();
	}

	function loadMenu(){
		var str="<a href='${pageContext.request.contextPath}/index' class='nav-header'><i class='icon-comment'></i>首页</a>";
		for(var i=0;i<menuArray.length;i++){
			var obj=menuArray[i];
			str+="<a href='#"+obj.id+"' class='nav-header' data-toggle='collapse'>";
			str+="<i class='"+obj.icon+"'></i>";
			str+=obj.parent;
			str+="</a>";
			str+="<ul id='"+obj.id+"' class='"+(parent==obj.parent?"nav nav-list collapse in":"nav nav-list collapse")+"'>";
			for(var j=0;j<obj.childList.length;j++){
				var childObj=obj.childList[j];
				str+="<li class='"+(child==childObj.name?"active":"")+"'><a onClick='menuClick(\'"+obj.parent+"\',\'"+childObj.name+"\')' href='"+childObj.url+"'>";
				str+=childObj.name;
				str+="</a></li>";
			}
			str+="</ul>";
		}

		$("#menuDiv").html(str);
	}

	$(function(){
		loadMenu();
	});


</script>


<script src="${pageContext.request.contextPath}/static/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
	$("[rel=tooltip]").tooltip();
	$(function() {
		$('.demo-cancel-click').click(function() {
			return false;
		});
	});
</script>

</body>
</html>